package com.example.administrator.appstpremvpdemo.binder;

import android.view.ViewGroup;

import com.example.administrator.appstpremvpdemo.R;
import com.example.administrator.appstpremvpdemo.common.Constances;

/**
 * @Author Administrator
 * @Date 2017/12/26
 * @description
 * @function    这个工厂类，根据条目类型生产对应条目布局的viewbinder
 */

public class ViewBinderFactory {

    public static BaseViewBinder getBinderFromLayoutId(ViewGroup viewGroup, int viewType) {
        BaseViewBinder mViewBinder = null;

        switch (viewType) {
        case Constances.ITEM_TYPE_HOME_LIST:
            mViewBinder = new HomeListBinder(viewGroup, R.layout.item_home_list);
            break;
        case Constances.ITEM_TYPE_APP_LIST:
            mViewBinder = new AppListBinder(viewGroup, R.layout.list_item);
            break;
        }

        return mViewBinder;
    }
}
